package com.fjc.security;

import com.alibaba.fastjson.JSONObject;


/**
 * Created by fjc on 2018/7/9.
 */
public class AnalysisRequestData {


    private static String rsaPrivateKey = "MIICeAIBADANBgkqhkiG9w0BAQEFAASCAmIwggJeAgEAAoGBAK6SR5NLVCcsHrm1H3SyDBzWMN6cqHTF+Jg7/dtVSPHJMLVqvlsT9SjOEanAbXX4HKBrMso/xJMBPL+L3nuGPu2lN3RUl0LfTBqv32tytMrijOGdkJq13YXPZx/BWlPu27hIsh4VdWpgdgiGJ2d3QeX0OfUji8tSwOZDLJ5wXuGXAgMBAAECgYBunEb3wDIZA+6P8oB021+rYdfjJVXjb5DdPJ3TvI0UjkrrmC/224VqDm/IpCF3LvdMeb/bwF3YW19XatNUZzI1Ki8wzLaRsIsrQRyGtWsILz66kZmqzFQWFdrDjo5M17BqW8WPCRi4TRQjcA43HU/4j253/SJGdfYBLTXSfJf/uQJBAOquCkIeVCmflgG4gfAnw1SZ/+0LLk8l/Uc6L9f5z87IidKHpx3nGe5bvu2bSC/ZLbu1dANKE/sWxFpg//FC900CQQC+bkt2tl62xz6gSD20hpIyU11IW0b+BjbT/KtMwDsYYSSuzDdKj/0YwE6DqzRyN9BSwvvS0ScUtdIELIpUD/JzAkEAp3pA0+K1CWdcNCoqgOq/mTa1z8L074Ma96Ps1OLwjI/M27P3bX2podNTtFnm8E67NoROILLTA5PB2QX0YYb62QJBAIcyRuFBGH0rd4rTvvsrjx+rj86O/xfZ0ZMvD26uC0aDsUdoNNj64PVxkkxogBOXDI+1XpONafGKJFBSTuLfb4ECQQC9/qBcw3Ih1k2L57tRyImNU5yw5a2g0hrTQejCQuiyhSiVYr6WXu3HcTvTcWiGbMr6RQJmmUQFA0WipC46/ush";

    public static JSONObject decryptData(String data)throws Exception{
        byte[] decodedData = RSAUtil.decryptByPrivateKey(data, rsaPrivateKey);
        String outputStr = new String(decodedData);
        return JSONObject.parseObject(outputStr);
    }


    public static String decryptKey(String key)throws Exception{
        byte[] decodedData = RSAUtil.decryptByPrivateKey(key, rsaPrivateKey);
        String outputStr = new String(decodedData);
        return outputStr;
    }
}
